package com.habdqn.studentmanager.bean.ajax;

import org.apache.commons.lang3.StringUtils;

import com.habdqn.studentmanager.bean.Bean;
import com.habdqn.studentmanager.constant.ErrorCode;

/**
 * @author Fan
 * ajax的响应实体类
 * 2017年5月13日
 * 
 */
public class Response extends Bean {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 错误码
	 */
	private String err = ErrorCode.Success;
	
	/**
	 * 错误内容
	 */
	private String msg = "成功";
	
	/**
	 * 数据
	 */
	private Object data;
	
	public static Response make(String err, String msg) {
		
		Response rsp = new Response();
		if (StringUtils.isNotEmpty(err)) {
			rsp.setErr(err);			
		}
		
		if (StringUtils.isNotEmpty(msg)) {
			rsp.setMsg(msg);			
		}
		
		return rsp;
	}
	
	public Response() {
		
	}
	
	/**
	 * @return the err
	 */
	public String getErr() {
		return err;
	}

	/**
	 * @param err the err to set
	 */
	public void setErr(String err) {
		this.err = err;
	}

	/**
	 * @return the msg
	 */
	public String getMsg() {
		return msg;
	}

	/**
	 * @param msg the msg to set
	 */
	public void setMsg(String msg) {
		this.msg = msg;
	}

	/**
	 * @return the data
	 */
	public Object getData() {
		return data;
	}

	/**
	 * @param data the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}
}
